home *** CD-ROM | disk | FTP | other *** search
- Path: diku.dk!not-for-mail
- From: Morten B=?iso-8859-2?Q?=F8geskov Jensen <bogeskov@diku.dk>?=
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: 3 bugs in SAS/C v. 6.56
- Date: Sat, 24 Feb 1996 12:48:22 +0100
- Organization: S.A.T.S.
- Sender: bogeskov@fjalar.diku.dk
- Message-ID: <312EFB06.708D@diku.dk>
- References: <4gjvvc$a3t@gjallar.daimi.aau.dk>
- NNTP-Posting-Host: odin.diku.dk
- Mime-Version: 1.0
- Content-Type: text/plain; charset=iso-8859-2
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (X11; I; HP-UX A.09.05 9000/715)
-
- #include <stdio.h>
-
- int main(void)
- {
- unsigned short a = 0xffff, b = 0xffff;
-
- if ((a | b) > (unsigned short)0x7fff) {
- printf("ok\n");
- } else {
- printf("bad\n");
- }
- return 0;
- }
-
- This should work.. But I haven't tested it, since I'm not at home, so I
- cannot reach out and get SAS/C.
- However I belive that ">" and other boolean operations are
- left-associative (I know), as so they take the type of the 2nd (right)
- parameter, and since 0x7fff per default is signed, there is an implicit
- type conversion of unsigned short to signed short. this is most
- unfortunate, however this is the way most C-compilers work.
-
- The other 2 examples I couldnt see why they wouldn't work.
-
- --
- 8)
- Morten bogeskov@diku.dk
-
- .. one mans constant is another mans variable
-